<?php
	$controller_list = $this->controller_list;
	echo "<form method = 'Post' name = 'main_form'>";
	echo  $this->formHidden('mode','delete');
	echo  $this->formHidden('id');
	echo  $this->formHidden('name');
	echo  $this->formHidden('controller_txt');
	echo "</form>";
	echo $this->formButton('add-controller','Thêm',array());
	echo "<table style = 'width:100%;' class = 'table table-bordered table-striped'>";
	if ($controller_list){
		echo "<tr class = 'tr2'>";
		echo "<th style ='width:40px;'>STT</th>";
		echo "<th align='left'>Tên</th>";
		echo "<th align='left'>Controller</th>";
		echo "<th style ='width:100px;' align='center'>Sửa</th>";
		echo "<th style ='width:100px;' align='center'>Xóa</th>";
		echo "</tr>";
		$i = 1;
		foreach ($controller_list as $value) {
			echo "<tr class = 'tr" . (($i%2) + 3) . "'>";
			echo "<td align = 'center'>" . $i . "</td>";
			echo "<td>" . $value['name'] . "</td>";
			echo "<td>" . $value['controller'] . "</td>";
			echo "<td align='center'>" . $this->formButton('edit_' . $value['id'],'Sửa',array('class' => 'btn_del edit_controller','controller_id' => $value['id'], 'controller_name' => $value['name'], 'controller' => $value['controller'])) . "</td>";
			echo "<td align='center'>" . $this->formButton('delete_' . $value['id'],'Xóa',array('class' => 'btn_del','onclick' => 'delete_controller(' . $value['id'] . ')')) . "</td>";
			echo "</tr>";
			$i++;
		}
	}else {
		echo "<tr>";
		echo "<td>Hiện chưa có dữ liệu</td>";
		echo "</tr>";
	}
	echo "</table>";
//	echo "<div id='add-form' title='Thêm' style = 'display:none'>";
//	echo "<form class = 'form-horizontal'>";
//	echo "<table width = 400px>";
//	echo "<tr>";
//	echo "<td width = 100px align = 'right'>Tên : ";
//	echo "</td>";
//	echo "<td>";
//	echo $this->formText('txt_name','',array('size' => '40'));
//	echo "</td>";
//	echo "</tr>";
//	echo "<tr>";
//	echo "<td align = 'right'>Controller : ";
//	echo "</td>";
//	echo "<td>";
//	echo $this->formText('txt_controller','',array('size' => '40'));
//	echo "</td>";
//	echo "</tr>";
//	echo "</table>";
//	echo "</form>";
//	echo "</div>";
	echo "<div id='add-form' title='Thêm' style = 'display:none'>";
	echo "<form class = 'form-horizontal form-inline' method = 'post'>";
	echo "<div class='control-group'>";
	echo "<label class='control-label'>Tên : </label>";
	echo "<div class = 'controls'>";
	echo $this->formText('txt_name','',array('class'	=> 'input-xlarge','placeholder'	=> 'Tên'));
	echo "</div>";
	echo "</div>";
	echo "<div class='control-group'>";
	echo "<label class='control-label'>Controller : </label>";
	echo "<div class = 'controls'>";
	echo $this->formText('txt_controller','',array('class'	=> 'input-xlarge','placeholder'	=> 'Controller'));
	echo "</div>";
	echo "</div>";
	echo "</form>";
	echo "</div>";
	
	echo "<div id='edit-form' title='Sửa' style = 'display:none'>";
	echo "<form class = 'form-horizontal'>";
	echo "<table width = 400px>";
	echo "<tr>";
	echo "<td width = 100px align = 'right'>Tên : ";
	echo "</td>";
	echo "<td>";
	echo $this->formText('edit_txt_name','',array('size' => '40'));
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td align = 'right'>Controller : ";
	echo "</td>";
	echo "<td>";
	echo $this->formText('edit_txt_controller','',array('size' => '40'));
	echo "</td>";
	echo "</tr>";
	echo "</table>";
	echo "</form>";
	echo "</div>";
